var page = require('webpage').create();
page.viewportSize = {width: 1600, height: 1024};
page.open('https://admin.foxitcloud.com/site/signin', function() {
    page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() {
        page.evaluate(function() {
            $('#signinform-email').val('admin@sumilux.com');
            $('#signinform-password').val('P@ssabc123');
            $('.form-group .col-lg-offset.col-lg button').click();
        });
        window.setTimeout(function () {
            page.open('https://admin.foxitcloud.com/appstore/app-sub-data',function(){
                window.setTimeout(function () {
                    // page.render('ga.png');
                    page.render('app_sub_data.pdf');
                    phantom.exit();
                }, 60*1000);
            });
        }, 10000 );
    });
});